<?php
/* 
-----------------------------------------------------------------
Copyright (c) 2010 25Solutions   All Rights Reserved.

This software is the confidential and proprietary information
of 25Solutions ("Confidential Information").
You shall not disclose such Confidential Information and shall
use it only in accordance with the terms of the license
agreement you entered into with 25Solutions
-----------------------------------------------------------------
*/



/** Enter the recipient filter:<br/>
SELECT * FROM recipient r WHERE ...
<form action="<?php echo url_for('campaign/updaterecipients?campaign_id='.$form->getObject()->getCampaignId()) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>
      <table id="campaign_recipients_form">
        <tfoot>
            <tr>
                <td colspan="2">
                    <input type="submit" value="Save" />
                </td>
            </tr>
        </tfoot>
        <tbody>
            //<?php echo $form ?>
        </tbody>
    </table>
</form>**/
?>


<?php include_partial('recipient/list', array('recipients' => $pager->getResults())) ?>

<?php if ($pager->haveToPaginate()): ?>
<div class="pagination">
    <a href="<?php echo url_for('campaign/editrecipients?campaign_id='.$campaign->getCampaignId()) ?>?page=1">
        <img src="/images/first.png" alt="First page" />
    </a>

    <a href="<?php echo url_for('campaign/editrecipients?campaign_id='.$campaign->getCampaignId()) ?>?page=<?php echo $pager->getPreviousPage() ?>">
        <img src="/images/previous.png" alt="Previous page" title="Previous page" />
    </a>

        <?php foreach ($pager->getLinks() as $page): ?>
            <?php if ($page == $pager->getPage()): ?>
                <?php echo $page ?>
            <?php else: ?>
    <a href="<?php echo url_for('campaign/editrecipients?campaign_id='.$campaign->getCampaignId()) ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
            <?php endif; ?>
        <?php endforeach; ?>

    <a href="<?php echo url_for('campaign/editrecipients?campaign_id='.$campaign->getCampaignId()) ?>?page=<?php echo $pager->getNextPage() ?>">
        <img src="/images/next.png" alt="Next page" title="Next page" />
    </a>

    <a href="<?php echo url_for('campaign/editrecipients?campaign_id='.$campaign->getCampaignId()) ?>?page=<?php echo $pager->getLastPage() ?>">
        <img src="/images/last.png" alt="Last page" title="Last page" />
    </a>
</div>
<?php endif; ?>

<div class="pagination_desc">
    <?php echo '<strong>'.count($pager).'</strong>Recipient(s) found'  ?>

    <?php if ($pager->haveToPaginate()): ?>
    - page <strong><?php echo $pager->getPage() ?>/<?php echo $pager->getLastPage() ?></strong>
    <?php endif; ?>
</div>